package com.orhon.smartcampus.modules.user.mm;


import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.SchoolMapper;
import com.orhon.smartcampus.modules.user.entity.Users;
import com.orhon.smartcampus.modules.user.gqlModel.GQLUser;

@Mapper(
        uses = {
                SchoolMapper.class
        }
)
public interface UserMapper {

    UserMapper MAPPER = Mappers.getMapper(UserMapper.class);

    @Mapping(source="id", target ="id")
    @Mapping(source="username", target ="username")
    @Mapping(source="password", target ="password")
    @Mapping(source="email", target ="email")
    @Mapping(source="status", target ="status")
    @Mapping(source="idCard", target ="idcard")
    @Mapping(source="last_login_ip", target ="last_login_ip")
    @Mapping(source="last_login_time", target ="last_login_time")
    @Mapping(source="remember_token", target ="remember_token")
    @Mapping(source="api_token", target ="api_token")
    @Mapping(source="created_at", target ="created_at")
    @Mapping(source="updated_at", target ="updated_at")
    @Mapping(source="deleted_at", target ="deleted_at")
    @Mapping(source="user_type", target ="user_type")
    @Mapping(source="system_lang", target ="system_lang")
    @Mapping(source="mobile", target ="mobile")
    @Mapping(source="equipment_id", target ="equipment")
    @Mapping(source="unionid", target ="union_id")
    @Mapping(source="school", target = "school")
    @Mapping(ignore = true, target = "name")
    GQLUser mapUser(Users entity);

    @InheritConfiguration(name = "mapUser")
    List<GQLUser> mapList(List<Users> users);


}
